package view.dialogs;

import javax.swing.JPanel;
import javax.swing.JTextField;

import view.components.IPTextArea;
import view.listeners.AddHostListener;
import view.listeners.CancelListener;
import view.views.dialogButtonViews.AddIpButtonPanel;
import view.views.dialogContentViews.AddHostContent;

public class AddHostDialog extends Dialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private IPTextArea ipText;
	private JTextField nameText;

	public AddHostDialog(String title) {
		super(title);

	}

	@Override
	protected JPanel addContent() {
		AddHostContent content = new AddHostContent();
		ipText = content.getIpTextArea();
		nameText = content.getNameTextField();
		return content;
	}

	@Override
	protected JPanel addButtons() {
		AddIpButtonPanel buttonPanel = new AddIpButtonPanel();
		buttonPanel.getCancelButton()
				.addActionListener(new CancelListener(this));
		buttonPanel.getAddButton().addActionListener(
				new AddHostListener(this, ipText, nameText));
		return buttonPanel;
	}

}
